package com.lvmama.java.rhino.etl.core;

import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SQLContext;

public abstract class AbstractSparkTemplate extends AbstractSparkBaseTemplate {

	private static final long serialVersionUID = 7635882521600420438L;
	
	transient protected JavaSparkContext sc = null;
	transient protected SQLContext sqlContext = null;
	
	public final void run(String[] args) {
		// 创建Spark 上下文
		sc = new JavaSparkContext(sparkConf);
		// 创建Spark SQL上下文
		sqlContext = new SQLContext(sc);
		// 执行业务逻辑
		excute(args);
	}
	
	public abstract void excute(String[] args);
}
